home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / qbatb503.zip / MIXED.DOC < prev    next >
Text File  |  1991-07-06  |  25KB  |  615 lines

  1.  
  2.             MIXED-LANGUAGE TOOLBOX FOR QuickBASIC
  3.             ─────────────────────────────────────
  4.                       By Christy Gemmell
  5.  
  6.  
  7. These are native QuickBASIC functions and procedures which call the
  8. machine-code routines in the Assembly-Language Toolbox for QuickBASIC.
  9. To use them, you must link both TOOLBOX.LIB, from the Assembly-Language
  10. Library disk, and the copy of MIXED.LIB from the Mixed-Language Library
  11. disk to your stand-alone programs, like this:
  12.  
  13.     LINK yourprog,,,toolbox.lib mixed.lib;
  14.  
  15. Since the QuickBASIC environment only allows one Quick Library to be
  16. loaded at a time, however, the version of MIXED.QLB supplied also
  17. contains all the routines from TOOLBOX.LIB. This allows you to use the
  18. environment to develop and test programs which use functions from 
  19. both libraries. Just start QuickBASIC with the command:
  20.  
  21.     QB(X) yourprog /L mixed.qlb
  22.  
  23. You can even build your own Quick Libraries, incorporating Toolbox
  24. routines, using the QuickBASIC Linker as follows:
  25.  
  26.     LINK /QU yoursub.obj yourfun.obj toolbox.lib mixed.lib,,bqlb45.lib;
  27.  
  28. BQLB45.LIB is the special interface library supplied with Microsoft's
  29. QuickBASIC 4.5 compiler. Substitute the following library names for other
  30. versions of the language.
  31.  
  32.     BQLB40.LIB          for QuickBASIC 4.0
  33.     BQLB41.LIB          for BASIC 6.0
  34.     QBXQLB.LIB          for BASIC 7.0 and 7.1 PDS
  35.  
  36. Be sure that, whichever interface library you use, it can be found by
  37. LINK.EXE when the library is being built. This can be done, either by
  38. copying it to the Linker's own directory or to a subdirectory pointed to
  39. by a LIB= environment variable in your AUTOEXEC.BAT file, for example:
  40.  
  41.     SET LIB=C:\QB45\LIBRARY
  42.  
  43. See your MS-DOS or PC-DOS manual for more information about environment
  44. variables.
  45.  
  46. If you have the Professional version of the Assembly-Language Toolbox,
  47. of course, building customised libraries is much easier since a full
  48. set of object (.OBJ) modules, together with source code, is supplied
  49. with this release.
  50.  
  51. The stand-alone (.LIB) and Quick Library (.QLB) versions of the Mixed-
  52. Language Toolbox both contain the following SUB programs and FUNCTION
  53. procedures:
  54.  
  55.  
  56. BARMENU
  57.  
  58. Creates and operates a menu orientated horizontally on the screen row
  59. specified. The calling program must supply :
  60.  
  61. Row%        =   The screen row on which the menu bar will appear.
  62. Atr%        =   The display attribute or colour for the menu bar.
  63. Opt%        =   Number of options available for selection.
  64. Menu$()     =   String array containing selection list. Menu$(0) should
  65.                 be set to a string of ASCII characters, corresponding to
  66.                 the initial or key letter of each option in the list.
  67. Bar%        =   The menu selection to be highlighted on entry into the
  68.                 procedure.
  69. Nxt%        =   If set, this flag just causes the menu to be refreshed
  70.                 without pausing for a selection from the user. This is
  71.                 used to handle presses on the Right or Left Arrow keys
  72.                 in the Pull-Down Menu procedure.
  73. Ctx%        =   If set, this flag indicates that context-sensitive help
  74.                 is available, in which case ...
  75. Tpc$        =   The root name of the Topic file to be displayed if the
  76.                 user presses <F1> for help. The current selection number
  77.                 is appended to this to produce the actual filename.
  78. Mouse%      =   If set, this flag indicates that a mouse is installed
  79.                 and can be used to make selections.
  80.  
  81. On completion the procedure returns with the following variable set:
  82.  
  83. Bar%        =   Number of selection made by user. If zero then the
  84.                 <Escape> key was pressed to abort the procedure
  85.                 without making a selection.
  86.  
  87. DECLARE SUB BarMenu (Row%, Atr%, Opt%, Menu$(), Bar%, Nxt%,_
  88.                      Ctx%, Topic$, Mouse%)
  89.  
  90. See the source code for DEMON.BAS, the Toolbox demonstration program, for
  91. an example of BARMENU in use.
  92.  
  93.  
  94. BINDEC
  95.  
  96. Translates a string of binary digits to their long integer decimal
  97. equivalent.
  98.  
  99. DECLARE FUNCTION BinDec& (Binary$)
  100.  
  101.  
  102. BITRESET
  103.  
  104. Clears the specified bit (0-15) of the integer number supplied.
  105.  
  106. DECLARE SUB BitReSet (Number%, Bit%)
  107.  
  108.  
  109. BITSET
  110.  
  111. Sets the specified bit (0-15) in the integer number supplied to 1.
  112.  
  113. DECLARE SUB BitSet (Number%, Bit%)
  114.  
  115.  
  116. BITTEST
  117.  
  118. Returns logical TRUE (-1) if the bit (0-15) of Number% is set and FALSE
  119. (zero) if the bit is clear.
  120.  
  121. DECLARE FUNCTION BitTest% (Number%, Bit%)
  122.  
  123.  
  124. CENTRE
  125.  
  126. Centres the string supplied within an empty string of specified width.
  127.  
  128. DECLARE FUNCTION Centre$ (Text$, MaxWidth%)
  129.  
  130. This function is called by the VERMENU routine (see below) to centre the
  131. title of a pull-down menu within the window it refers to.
  132.  
  133.  
  134. CHECKPRINTER
  135.  
  136. This procedure checks if the specified parallel printer is ready and
  137. on-line. If so, it returns immediately with Ready% set to -1 (TRUE), if
  138. not, CHECKPRINTER displays the message 'PRINTER NOT READY' on the bottom
  139. row of the screen and waits for the operator to correct the problem and
  140. press a key.
  141.  
  142. If the user presses <Escape>, the procedure returns with Ready% set to
  143. zero (FALSE). Any other keystroke causes it to go back and test the
  144. printer again. CHECKPRINTER will not return until either the printer is
  145. ready for output, or the <Escape> key is pressed.
  146.  
  147. DECLARE SUB CheckPrinter (Printer%, Ready%)
  148.  
  149. Printer% is the number of the parallel printer to test (1 = LPT1: etc).
  150.  
  151. Example:    CheckPrinter 1, Ready%              ' Test LPT1:
  152.             IF NOT Ready% THEN
  153.                STOP
  154.             ELSE
  155.                LPRINT Stuff$
  156.             END IF 
  157.  
  158.  
  159. DATEINPUT
  160.  
  161. Accepts and verifies date input in a Reverse Video entry panel, all the
  162. usual editing keys are supported and entry is terminated by either a
  163. Carriage Return or one of several special function keys (see below).
  164.  
  165. DECLARE FUNCTION DateInput$ (Default$, Context%, Topic$, HotKey%)
  166.  
  167. Default$    =  default string which can be accepted by just pressing
  168.                the <Enter> key.
  169. Context%    =  set TRUE if context-sensitive help is available, in
  170.                which case ... 
  171. Topic$      =  name of the HELP Topic file to display whenever the
  172.                <F1> key is pressed. 
  173. HotKey% =  If entry is terminated by anything other than the
  174.                <Enter> key, this variable will contain an explanatory
  175.                return code ..
  176.  
  177. Return Codes:   1  =  <Escape> abort entry returning a null string
  178.                 2  =  <F2>     repeat previous entry for this field
  179.                 3  =  <Up Arr> pressed, move to previous field 
  180.                 4  =  <Dn Arr> pressed, move to next field
  181.                 5  =  <Pg Up>  pressed, move to top of screen
  182.                 6  =  <Pg Dn>  pressed, move to end of screen
  183.  
  184. Editing Keys:   <L.Arrow>   =  Move cursor one character to the left
  185.                 <R.Arrow>   =  Move cursor one character to the right
  186.                 <Home>      =  Move cursor to first character of field
  187.                 <End>       =  Move cursor to last character of field
  188.                 <Ctrl End>  =  Clear from current cursor position to
  189.                                the end of the entry field.
  190.                 <BackSpace> =  Replace character under cursor with a
  191.                                blank space and move cursor one character
  192.                                to the left.
  193.                 <F1>        =  pop up on-line HELP screen.
  194.  
  195. DATEINPUT is designed to be used as part of a full-screen data-entry
  196. system. Your program can examine the return code to determine whether
  197. the operator wishes to terminate entry or move forwards or backwards
  198. between entry fields.
  199.  
  200. See also the REVINPUT function for a similar, more general-purpose,
  201. data-entry routine.
  202.  
  203.  
  204. DAYSBETWEEN
  205.  
  206. Calculates the number of days between two dates, supplied as strings in
  207. the format DD/MM/YYYY. The function will provide accurate results when
  208. supplied with dates between 01/01/1901 and 31/12/2099.
  209.  
  210. DECLARE FUNCTION DaysBetween& (Date1$, Date2$)
  211.  
  212. See the INT